import { axios } from '~/plugins/axios';

// 案例列表
export const getList = (params?: any) => axios({
  method: 'get',
  url: '/projectCase/list',
  params,
}) as Promise<any>;

// 我的案例列表
export const myList = (params?: any) => axios({
  method: 'get',
  url: '/projectCase/my_list',
  params,
}) as Promise<any>;

// 案例列表 - 删除
export const deleteItem = (params: any) => axios({
  method: 'delete',
  url: `/projectCase/${params as string}`,
}) as Promise<any>;

// 新增案例 (编辑案例)
export const addCase = (params: any) => axios({
  method: 'post',
  url: params.id === '' ? '/projectCase/add' : '/projectCase/update',
  data: {
    ...params,
  },
}) as Promise<any>;

// 获取案例
export const getCase = (params: string) => axios({
  method: 'get',
  url: `/projectCase/${params}`,
}) as Promise<any>;
